#include "StdAfx.h"
#include "locker.h"

namespace Zen{ namespace utility{

	critical_section gcs;

	critical_section::critical_section() {InitializeCriticalSection(&cs);}
	critical_section::~critical_section() {DeleteCriticalSection(&cs);}
	void critical_section::lock() {EnterCriticalSection(&cs);}
	void critical_section::unlock() {LeaveCriticalSection(&cs);}

	locker::locker(critical_section& cs/* = gcs*/) : cs_(cs) {cs_.lock();}
	locker::~locker(){cs_.unlock();}

}}
